<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<progress id="progress" max=100></progress>
<p id="peas" />
<pre id="console">
This tests that layout tests can access shadow DOM.

</pre>
<script>
if (window.internals) {
    // Make assertions about a built-in shadow
    var progress = document.getElementById('progress');
    var shadow = internals.shadowRoot(progress);
    shouldBe('shadow.nodeName', '"#document-fragment"');

    // Shadow roots aren't elements, so accessing their shadow should throw.
    shouldThrow("internals.shadowRoot(shadow)");

    // Ordinary element should not have shadow
    var p = document.getElementById('peas');
    shouldBe('internals.shadowRoot(p)', 'null');

    // Can bless ordinary elements with shadows
    shadow = p.attachShadow({mode: 'open'});
    shouldBe('shadow.nodeName', '"#document-fragment"');
    shouldBe('shadow === internals.shadowRoot(p)', 'true');
}
</script>
</body>
</html>
